<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" id="aid">
<head>
  <meta charset="utf-8">
  <title>客户管理 / 人员管理</title>
  <link rel="stylesheet" href="../../../css/layui.css" media="all">	
  <link rel="stylesheet" type="text/css" href="../../../css/common.css"/>
	<link rel="stylesheet" type="text/css" href="../../../zTree/zTreeStyle/zTreeStyle.css"/>
</head>
<body class="inner-body layui-row layui-col-space10" style="background:#f2f2f2;position: relative; ">
<div class="body-left treeDiv">
	<ul id="treeDemo" class="ztree"></ul>
</div>
<!-------默认表格开始----------->
<div class="body-right">	 
	<div class="tableHtml" style="height: 100%;background: #FFFFFF; min-width: 800px;">
		<div class="top-btn">
			<div class="layui-btn-group">
				<button class="layui-btn" id="addBtn">新建人员</button>
				<button class="layui-btn" id="importBtn">导入人员信息</button>
				<button class="layui-btn" id="editBtn">编辑</button>
				<button class="layui-btn" id="detailBtn">详情</button>
		 	</div>
		 	<div class="search-btn-group layui-form">
				<input type="text"  autocomplete="off" class="layui-input layui-input_" placeholder="请输入学工号">
				<div class="layui-input-block" style="display: inline-block; margin-left: 0px;">
					<select name="interest" lay-filter="">
					  <option value="0">授权状态</option>
					  <option value="1">全部</option>
					  <option value="2">已授权</option>
					  <option value="3">未授权</option>			  
					</select>
				</div>
		 		<button class="layui-btn layui-btns">查询</button>
			</div>
		</div>
		<div class="tableDiv" >
			<table id="layui-table" lay-filter="tableBox" class="layui-table"></table>
		</div>
	</div>
</div>

<!-----------------默认表格结束------------>

</body>
<script type="text/html" id="barDemo">
	{{# if(d.status == "0"){ }}
	<span class="layui-badge-dot ayui-bg-orange"></span><a class="" lay-event="choose">未授权</a>
	{{# } }}
	{{# if(d.status == "1"){ }}
	<span class="layui-badge-dot layui-bg-green"></span><a class="" lay-event="shouquan" style="cursor: pointer;">已授权</a>
	{{# } }}
</script>
	
<script src='../../../layui.all.js'></script>
<script src="../../../js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../../../zTree/jquery.ztree.all.js" type="text/javascript"></script>
<script src="../../../zTree/jquery.ztree.exhide-3.5.min.js" type="text/javascript"></script>
<script src="../../../zTree/MtrSearchZTree.js" type="text/javascript"></script>
<script type="text/javascript">
	var setting = {	};
		
		var zNodes =[
			{ name:"合肥一中", open:true,
				children: [
					{ name:"主校区",open:true,
						children: [
							{ name:"C层级菜单1"},
							{ name:"C层级菜单2"},
							{ name:"C层级菜单3"},
						]},
					{ name:"二级校区",
						children: [
							{ name:"C层级菜单1"},
							{ name:"C层级菜单2"},
							{ name:"C层级菜单3"},
						]},
					{ name:"三级校区",
						children: [
							{ name:"C层级菜单1"},
							{ name:"C层级菜单2"},
							{ name:"C层级菜单3"},
						]}
				]},
				{ name:"合肥二中",
					children: [
						{ name:"主校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]},
						{ name:"二级校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]},
						{ name:"三级校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]}
				]},
				{ name:"合肥三中",
					children: [
						{ name:"主校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]},
						{ name:"二级校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]},
						{ name:"三级校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]}
				]},
				{ name:"合肥四中",
					children: [
						{ name:"主校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]},
						{ name:"二级校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]},
						{ name:"三级校区",
							children: [
								{ name:"C层级菜单1"},
								{ name:"C层级菜单2"},
								{ name:"C层级菜单3"},
							]}
					]},
		];

		$(document).ready(function(){
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			new MtrSearchZTree();
		});
//主动加载jquery模块
layui.use(['jquery', 'layer'], function(){
	var $ = layui.jquery //重点处
	,layer = layui.layer;
	table = layui.table;//表格，注意此处table必须是全局变量
	$(".treeDiv").height($('.body-right').height()-4);//树高度
	
	var arr = [[ 
	    {type:'checkbox'}
      ,{field: 'name', title: '姓名'}
      ,{field: 'sbmc', title: '部门'}
      ,{field: 'pc', title: '卡号'}
	  ,{field: 'pc', title: '学工号'}
	  ,{fixed: 'right', title:'状态', toolbar: '#barDemo', width:150}
      
    ]];
	var limitArr =[10,20,30];
	var urls = '../../../tableJson.js';
	com.tableRender('#layui-table','tableId','full-53',limitArr,urls,arr);//加载表格,注意tableId是自定义的，在表格重载需要！！

    /*-----新增-----*/
 	$("#addBtn").click(function(){	
	  com.pageOpen("新增","html/cust-mgt/person-mgt/add.html",['930px', '500px']);
	})
	/*-----导入人员-----*/
	$("#importBtn").click(function(){	
	  com.pageOpen("导入人员","html/cust-mgt/person-mgt/import.html",['930px', '520px']);
	})
	
    /*-----编辑-----*/
 	$("#editBtn").click(function(){	
	  com.checkOpen("编辑","html/cust-mgt/person-mgt/edit.html",['930px', '520px']);
	})
	/*-----详情-----*/
	$("#detailBtn").click(function(){	
	  com.checkOpen("详情","html/cust-mgt/person-mgt/detail.html",['930px', '520px']);
	})
	
	//监听行工具事件
	  table.on('tool(tableBox)', function(obj){
	    var data = obj.data;
	    console.log(obj)
	    if(obj.event === 'shouquan'){
	      com.pageOpen("已授权设备","html/cust-mgt/person-mgt/auth.html",['930px', '500px']);
	    } else if(obj.event === 'edit'){
	      
	    }
	  });

})	
</script>
</html>